package com.mangofactory.aop.configuration
{
import com.mangofactory.aop.configuration.ClassProxyDefinition;
import com.mangofactory.aop.configuration.MethodProxyDefinition;
import com.mangofactory.aop.interceptors.DelegatingInterceptor;

import mx.core.IFactory;

import org.as3commons.bytecode.interception.BasicMethodInvocationInterceptor;

public class InterceptorFactory implements IFactory
{
	private var definition:ClassProxyDefinition;
	public function InterceptorFactory(definition:ClassProxyDefinition)
	{
		this.definition = definition;
	}
	
	public function newInstance():*
	{
		var interceptor:BasicMethodInvocationInterceptor = new BasicMethodInvocationInterceptor();
		interceptor.interceptors.push(new DelegatingInterceptor(definition));
		return interceptor;
	}
}
}
